const KKB = require('./src/kkb')
const app = new KKB()

const Router = require('./src/router')
const router = new Router()

const static = require('./src/static')
app.use(static(__dirname + '/public'));

app.use((ctx,next) => {
    console.log(11111)
    next()
})

app.use((ctx,next) => {
    console.log(22222)
    next()
})

router.get('/index', async ctx => { ctx.body = 'index page'; });
router.get('/post', async ctx => { ctx.body = 'post page'; });
router.get('/list', async ctx => { ctx.body = 'list page'; });
router.post('/index', async ctx => { ctx.body = 'post page'; });

// 路由实例输出父中间件 router.routes()
app.use(router.routes());


app.use((ctx,next) => {
    console.log(44444)
    next()
})

app.listen(3000)